<template>
  <el-aside width="80px">
    <div class="aside-wrap">
      <el-avatar :class="'iconfont icon-shuzi'+defaultDatabase"></el-avatar>
      <div class="icon-wrap">
        <el-dropdown trigger="click">
          <div>
            <span :class="'iconfont icon-shuzi'+defaultDatabase"></span><br><br>
            <span class="icon-tips">DataBase</span>
          </div>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item v-for="(i,index) in 16" :key="i" :class="'iconfont icon-shuzi'+index"
                                @click="handleDbSelect(index)"></el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </div>
      <div class="icon-wrap" @click="handleIconClick('terminal')">
        <i class="el-icon-folder"></i>
        <span class="icon-tips">Terminal</span>
      </div>
      <div class="icon-wrap" @click="handleIconClick('setting')">
        <i class="el-icon-setting"></i>
        <span class="icon-tips">Config</span>
      </div>
    </div>
  </el-aside>
</template>

<script>
export default {
  name: "homeaside",
  data() {
    return {
      defaultDatabase: 0,
    }
  },
  methods: {
    handleIconClick(icon) {
      console.log(icon + " Click");
    },
    handleDbSelect(db) {
      this.defaultDatabase = db
    }
  }
}
</script>

<style scoped lang="less">
.el-aside {
  background-color: #efefef;
  text-align: center;
  line-height: 30px;

  .aside-wrap {
    padding-top: 30px;
  }

  .icon-wrap {
    font-size: 30px;
    color: #7f7f7f;
    padding: 15px 0;

    .icon-tips {
      display: block;
      font-size: 12px;
    }
  }
}

</style>